<template>
  <div class="app-bottom">
	<van-tabbar v-model="active" v-if="is_admin == 0" route>
	  <van-tabbar-item name="0" icon="home-o" to='/'>共享</van-tabbar-item>
	  <van-tabbar-item name="1" icon="add-o" active to='/add'>创建</van-tabbar-item>
	  <van-tabbar-item name="2" icon="manager-o" to='/my'>我的</van-tabbar-item>
	</van-tabbar>
	<van-tabbar v-model="active" v-else>
	  <van-tabbar-item name="0" icon="home-o" to='/'>共享</van-tabbar-item>
	  <van-tabbar-item name="1" icon="add-o" to='/add'>创建</van-tabbar-item>
	  <van-tabbar-item name="2" icon="manager-o" to='/my'>我的</van-tabbar-item>
	  <van-tabbar-item name="3" icon="passed" to='/check'>待审</van-tabbar-item>
	  <van-tabbar-item name="4" icon="bar-chart-o" to="/chart">统计</van-tabbar-item>
	</van-tabbar>
</div>
</template>
<script>
import {isAdmin} from '@/api/app.js'
export default {
  data() {
    return {
    	active: '0',
      user: this.$store.state.user,
      is_admin: this.$store.state.isadmin
    }
  },
  components: {},
  computed: {},
  mounted() {},
  created() {
  	let r = {
  		Chart: '4',
  		Index: '0',
  		Add: '1',
  		My: '2',
  		Check: '3'
  	}
  	let name = this.$route.name
  	if(r[name])this.active = r[name]
    if(this.is_admin == -1) {
      isAdmin().then(res=> {
        this.is_admin = res
        this.$store.commit('SET_ISADMIN', res)
      })
    }
    
  },

  methods: {
    
  }
}
</script>